function pickDate() {
    var randomnumber = Math.floor(Math.random() * 4);
    var randomdays = Math.floor(Math.random() * 7);
    var thisDate = new Date();
    switch (randomnumber) {
        case 0:
            thisDate.addDays(randomdays);
            break;
        case 1:
            thisDate.addWeeks(randomdays);
            break;
        case 2:
            thisDate.addMonths(randomdays);
            break;
    }
    return thisDate;
}

function refreshHTML(){
    $('BODY').html(MyList.lists.getItemHTML())
}

MyList.lists.addItem({title:'Item 1',complete:true});
MyList.lists.addItem({title:'Item 2',notes:'I added some notes'});
MyList.lists.addItem({title:'Item 3',complete:true,dueDate: pickDate()});

MyList.lists.items[0].addItem({title:'Item 1.1',notes:'This is my first subItem :)',dueDate: pickDate()});
MyList.lists.items[0].addItem({title:'Item 1.2',notes:'I added some notes'});
MyList.lists.items[0].addItem({title:'Item 1.3',complete:true});

MyList.lists.items[1].addItem({title:'Item 2.1',dueDate: pickDate()});
MyList.lists.items[1].addItem({title:'Item 2.2',notes:'I added some notes',dueDate: pickDate()});
MyList.lists.items[2].addItem({title:'Item 3.1',complete:true,dueDate: pickDate()});
MyList.lists.items[2].addItem({title:'Item 3.2',complete:true,dueDate: pickDate()});
MyList.lists.items[2].items[0].addItem({title:'Item 3.1.1',complete:true,dueDate: pickDate()});
MyList.lists.items[2].items[0].addItem({title:'Item 3.1.2',complete:true,dueDate: pickDate()});
MyList.lists.items[2].items[1].addItem({title:'Item 3.2.1',complete:true,dueDate: pickDate()});
MyList.lists.items[2].items[1].items[0].addItem({title:'Item 3.2.1.2',complete:true,dueDate: pickDate()});
MyList.lists.items[2].items[1].addItem({title:'Item 3.2.2',complete:true,dueDate: pickDate()});

MyList.lists.addItem({title:'Item 1',complete:true});
MyList.lists.addItem({title:'Item 2',notes:'I added some notes'});
MyList.lists.addItem({title:'Item 3',complete:true,dueDate: pickDate()});

MyList.lists.items[0].addItem({title:'Item 1.1',notes:'This is my first subItem :)',dueDate: pickDate()});
MyList.lists.items[0].addItem({title:'Item 1.2',notes:'I added some notes'});
MyList.lists.items[0].addItem({title:'Item 1.3',complete:true});

MyList.lists.items[1].addItem({title:'Item 2.1',dueDate: pickDate()});
MyList.lists.items[1].addItem({title:'Item 2.2',notes:'I added some notes',dueDate: pickDate()});
MyList.lists.items[2].addItem({title:'Item 3.1',complete:true,dueDate: pickDate()});
MyList.lists.items[2].addItem({title:'Item 3.2',complete:true,dueDate: pickDate()});
MyList.lists.items[2].items[0].addItem({title:'Item 3.1.1',complete:true,dueDate: pickDate()});
MyList.lists.items[2].items[0].addItem({title:'Item 3.1.2',complete:true,dueDate: pickDate()});
MyList.lists.items[2].items[1].addItem({title:'Item 3.2.1',complete:true,dueDate: pickDate()});
MyList.lists.items[2].items[1].items[0].addItem({title:'Item 3.2.1.2',complete:true,dueDate: pickDate()});
MyList.lists.items[2].items[1].addItem({title:'Item 3.2.2',complete:true,dueDate: pickDate()});

setTimeout(function(){$('BODY').append(MyList.lists.getItemHTML());},1);

function makeDraggable(){
$('UL').eq(0).NestedSortable(
	{
	accept: 'sortable',
	opacity: .8,
	helperclass: 'helper',
    onChange: function(serialized) {
//        console.log(serialized);
//        console.log(this);
	},
//    onHover: function(param){
//        console.log(param);
//        console.log(this);
//    },
	//rightToLeft: true,
	nestingPxSpace: '60',
	currentNestingClass: 'current-nesting'
	}
);
}

//console.log(JSON.stringify(MyList));